package com.woodws.fresh.square.utils;

import com.woodws.fresh.square.entity.common.ErrorCodeConstants;
import com.woodws.fresh.square.entity.common.Result;

public class ResultUtil {

    public static Result success(Object object){
        Result result = new Result();
        result.setErrorCode(ErrorCodeConstants.SUCCESS.getErrorCode());
        result.setErrorMessage(ErrorCodeConstants.SUCCESS.getErrorMessage());
        result.setObj(object);
        return result;
    }

    public static Result success(){
        Result result = new Result();
        result.setErrorCode(ErrorCodeConstants.SUCCESS.getErrorCode());
        result.setErrorMessage(ErrorCodeConstants.SUCCESS.getErrorMessage());
        return result;
    }

    public static Result failure(){
        Result result = new Result();
        result.setErrorCode(ErrorCodeConstants.FAILURE.getErrorCode());
        result.setErrorMessage(ErrorCodeConstants.FAILURE.getErrorMessage());
        return result;
    }

}
